package example04;

public class Ticket implements Runnable {
    private int tickets = 100;

    public void run() {
        while (true) {
            if (tickets > 0) {
                String name = Thread.currentThread().getName();
                System.out.println(name + "正在发售第" + tickets-- + "车票");
            } else {
                break;
            }
        }
    }
}
